from common.BasePages import BasePage


class GatewayAgreement(BasePage):
    # 网关管理-协议管理
    def gateway_agreement_url(self):
        self.goto_url("projectManagement/gatewayManagement")

    def create_gateway_agreement(self):
        self.click_more_functions("网关管理", "协议配置")
        self.page.get_by_role("button", name="  串口协议添加").click()
        self.page.get_by_role("textbox", name="请选择COM口").click()
        self.page.get_by_role("listitem").filter(has_text="com0(485)").click()
        self.page.get_by_role("button", name="确 定").click()
        self.assert_alert_content("协议添加成功")
